package cn.stylefeng.guns.modular.dept.type.service.impl;

import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory;
import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.modular.dept.type.entity.DeptType;
import cn.stylefeng.guns.modular.dept.type.mapper.DeptTypeMapper;
import cn.stylefeng.guns.modular.dept.type.model.params.DeptTypeParam;
import cn.stylefeng.guns.modular.dept.type.model.result.DeptTypeResult;
import  cn.stylefeng.guns.modular.dept.type.service.DeptTypeService;
import cn.stylefeng.roses.core.util.ToolUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author syt
 * @since 2020-10-09
 */
@Service
public class DeptTypeServiceImpl extends ServiceImpl<DeptTypeMapper, DeptType> implements DeptTypeService {

    @Override
    public List<DeptTypeResult> findList(DeptTypeParam param) {
        return this.baseMapper.customList(param);
    }

    private Serializable getKey(DeptTypeParam param){
        return param.getTypeId();
    }

    private Page getPageContext() {
        return LayuiPageFactory.defaultPage();
    }

    private DeptType getOldEntity(DeptTypeParam param) {
        return this.getById(getKey(param));
    }

    private DeptType getEntity(DeptTypeParam param) {
        DeptType entity = new DeptType();
        ToolUtil.copyProperties(param, entity);
        return entity;
    }

}
